﻿	config.initpage = function(formNode){
		var event = formNode.event;
		
		var checkval = function(form) {
			var chgtype = form.get('money_change__change_type');
			if (chgtype == '1') return true;
			
			var fdmoney = form.findField('money_change__after_money');
			var plan_money = fdmoney.getValue();
			
			if (plan_money.length == 0 || parseFloat(plan_money) == 0) {
				JxHint.alert('调整后的总投资金额不能为0！');
				fdmoney.focus(true);
				return false;
			}
			
			var ydmoney = form.findField('money_change__after_yearmoney');
			var year_money = ydmoney.getValue();
			if (year_money.length == 0 || parseFloat(year_money) == 0) {
				JxHint.alert('调整后的年度投资金额不能为0！');
				ydmoney.focus(true);
				return false;
			}
			
			if (parseFloat(year_money) > parseFloat(plan_money)) {
				JxHint.alert('调整后的年度投资不能大于总投资！');
				return false;
			}
			return true;
		};
		
		event.on('beforeaudit', function(event) {
			return checkval(event.form);
		});
		
		//扩展保存前事件，如果投资金额为0，则不能保存
		event.on('beforesave', function(event, data) {
			return checkval(event.form);
		});
	};